<!--
 * @Description  : Icon
 * @Autor        : 杜康
 * @Date         : 2023-03-06 17:24:54 +0800
 * @LastEditors  : 杜康
 * @LastEditTime : 2023-03-20 10:21:17 +0800
-->
<template>
  <div class="icons">
    <template v-for="(icon, key) in iconList" :key="key">
      <div class="icons-item">
        <el-icon size="24">
          <component :is="icon" />
        </el-icon>
        <span class="icons-item-name" v-text="icon"></span>
      </div>
    </template>
  </div>
</template>

<script setup>
import { reactive, ref } from "vue";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
const iconList = reactive([]);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  const { name } = component;
  iconList?.push(name);
}
</script>

<style lang="less" scoped>
.icons {
  position: relative;
  height: 100%;
  width: 100%;
  border-top: 1px solid var(--el-border-color);
  border-left: 1px solid var(--el-border-color);
  border-radius: 4px;
  // 栅格
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  &-item {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--el-text-color-regular);
    height: 90px;
    border-right: 1px solid var(--el-border-color);
    border-bottom: 1px solid var(--el-border-color);
    transition: background-color var(--el-transition-duration);
    &-name {
      font-size: 10px;
      margin-top: 6px;
    }
  }
}
</style>
